/*
 * Systemprogrammierung

 * Multiplayer-Quiz
 *
 * Gemeinsam verwendete Module
 *	common/rfc.h
 *Definitionen für das Netzwerkprotokoll
 */

#ifndef RFC_H
#define RFC_H

#include "common/question.h"

//Fehler
#define WARNING 0
#define FATAL 1
#define RFC_UNKNOWN -1
#define SOCKET_ERROR -2
#define SEND_ERROR -3
#define RECEIVE_ERROR -4
#define COM_ERR -5
#define SERVER_FULL 254
#define NAME_EXISTS 253
#define THREAD_ERROR 252
#define UNKNOWN_ERROR 251
#define NO_USERS 250
#define SPIELLEITER_LEFT 249
#define CLIENT_LEFT 248
#define GAME_RUNNING 247
#define CATALOG_ERROR 246
#define ONLY_ONE 245

//Socket uebertragungstypen
#define LOGIN_REQUEST 1
#define LOGIN_RESPONSE_OK 2
#define CATALOG_REQUEST 3
#define CATALOG_RESPONSE 4
#define CATALOG_CHANGE 5
#define PLAYER_LIST 6
#define START_GAME 7
#define QUESTION_REQUEST 8
#define QUESTION 9
#define QUESTION_ANSWERED 10
#define QUESTION_RESULT 11
#define GAME_OVER 12
#define ERROR_WARNING 255


#define HEADER_LENGTH 3
#define MAX_USERS 6




#pragma pack(1)


struct RFCHEADER {
	uint8_t type;
	uint16_t length;
};
struct RFCMSG {
	struct RFCHEADER header;
	void* data;
};

#pragma pack(0)

#endif
